package com.chuantou.yuba.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.chuantou.yuba.R;
import com.chuantou.yuba.api.UriHelper;
import com.chuantou.yuba.ui.fragment.IntegralListFragment;
import com.chuantou.yuba.util.Constants;

/**
 * 积分明细界面
 * 
 * @author Administrator
 * 
 */
public class IntegralListActivity extends BaseActionBarActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		IntegralListFragment fragment = new IntegralListFragment();
		getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
		setTitle(R.string.integral_detail);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.menu_integral, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menu_integral_detail:
			Intent intent = new Intent(this, WebViewActivity.class);
			intent.putExtra(Constants.EXTRA_URL, UriHelper.getIntegralRuleUrl());
			intent.putExtra(Constants.EXTRA_TITLE, getString(R.string.integral_rule));
			startActivity(intent);
			break;
		default:
			break;
		}
		return super.onOptionsItemSelected(item);
	}
}
